/*
Copyright 2005-2015 CP Fricano - All Rights Reserved

This software and source code is licensed under the Apache
License, Version 2.0. You may not use this software or source
code except in compliance with the License.  You may obtain a
copy of the License at: http://www.apache.org/licenses/LICENSE-2.0.
Use and distributed under this License is on an "as is" basis,
without expressed or implied warranties or conditions of any kind.
See the License for the specific language governing permissions and
limitations.
 */

package com.fricano.java42.swing.dings.tester;

import java.awt.Window;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JTree;
import javax.swing.JWindow;

import com.fricano.java42.base.components.utility.impl.Utility;
import com.fricano.java42.base.exception.ProgramCheck;
import com.fricano.java42.swing.dings.J42SwingDingController_SlideWindow.Alignment;
import com.fricano.java42.swing.dings.J42SwingDingManager_SlideWindow;
import com.fricano.java42.swing.dings.J42SwingDing_Factory;

public class TestCase {

    public static void main(final String[] args) {

        Alignment alignment = Alignment.EXTERIOR_BOTTOM;
        Window w = null;
        final JTree slidingComponent = new JTree();
        slidingComponent.setSize(100, 100);

        final int test = 200;
        System.out.println("TEST: " + test);

        switch (test) {

        // pass
            case 100:
                w = new JWindow();
                w.setVisible(true);
                w.setAlwaysOnTop(true);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // pass
            case 101:
                w = new JWindow();
                w.setVisible(true);
                w.setAlwaysOnTop(false);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // pass
            case 200:
                w = new JDialog();
                w.setVisible(true);
                w.setAlwaysOnTop(true);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // pass
            case 201:
                w = new JDialog();
                w.setVisible(true);
                w.setAlwaysOnTop(false);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // pass
            case 300:
                w = new JFrame();
                w.setVisible(true);
                w.setAlwaysOnTop(true);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // pass
            case 301:
                w = new JFrame();
                w.setVisible(true);
                w.setAlwaysOnTop(false);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // fail - not transparent
            case 0:
                w = null; // FULL SCREEN
                alignment = Alignment.INTERIOR_RIGHT;
                break;

            // pass
            case 1:
                w = null; // FULL SCREEN
                alignment = Alignment.INTERIOR_LEFT;
                break;

            default:
                throw new ProgramCheck("no test selected");
        }

        final J42SwingDing_Factory factory = new J42SwingDing_Factory(w);
        final J42SwingDingManager_SlideWindow m = factory.create_SlideManager();
        m.attachSlider(alignment, slidingComponent, 10, 1400, 0, 0);
        m.slideOpen(true);
        m.slideClosed(true);
        m.slideOpen(true);

        Utility.sleepSeconds(5);
        // if (test <= 200) {
        // m.detachSlider(slidingComponent);
        // }
        if (test >= 100) {
            w.dispose();
        }
    }

}
